package com.pacy.pacybaseproject.activitys;

import androidx.appcompat.app.AppCompatActivity;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

import com.pacy.pacybaseproject.MainActivity;
import com.pacy.pacybaseproject.R;

public class SplashActivity extends AppCompatActivity {
    private CountDownTimer timer=new CountDownTimer(2000,1000) {
        @Override
        public void onTick(long millisUntilFinished) {

        }

        @Override
        public void onFinish() {
            Intent intent=new Intent(SplashActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
        }
    };
    private ObjectAnimator scaleIvAnimationX,scaleIvAnimationY,translationIvAnimationX,alphaTv;
    private AnimatorSet ivSet;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_splash);
        timer.start();


    }

//    private void startAnimation(){
//        scaleIvAnimationX= ObjectAnimator.ofFloat(logo_iv,"scaleX",1f,0.5f);
//        scaleIvAnimationX.setDuration(500);
//        scaleIvAnimationY= ObjectAnimator.ofFloat(logo_iv,"scaleY",1f,0.5f);
//        scaleIvAnimationY.setDuration(500);
//
//        translationIvAnimationX=ObjectAnimator.ofFloat(logo_iv,"translationX",0f,-230f);
//        translationIvAnimationX.setDuration(1000);
//
//
//        alphaTv=ObjectAnimator.ofFloat(slogen_tv,"alpha",0f,2f);
//        alphaTv.setDuration(2000);
//        ivSet=new AnimatorSet();
//        ivSet.play(scaleIvAnimationX).with(scaleIvAnimationY).before(translationIvAnimationX).before(alphaTv).after(1000);
//        ivSet.start();
//
//        ivSet.addListener(new AnimatorListenerAdapter() {
//            @Override
//            public void onAnimationEnd(Animator animation) {
////                if(XUtils.isLogin()){
////                    Intent intent=new Intent(SplashActivity.this, MainActivity.class);
////                    startActivity(intent);
////                }else{
////                    Intent intent=new Intent(SplashActivity.this,LoginActivity.class);
////                    startActivity(intent);
////                }
//                Intent intent=new Intent(SplashActivity.this, MainActivity.class);
//                startActivity(intent);
//                finish();
//            }
//        });
//    }

}